home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / PlayerStatus.as < prev    next >
Encoding:
Text File  |  2007-09-27  |  4.0 KB  |  130 lines

  1. class PlayerStatus
  2. {
  3.    var aStoryLevels;
  4.    var aUserLevels;
  5.    static var MAX_USER_LEVELS = 9;
  6.    static var SAVE_SO_NAME = "Nick_Tak_Save";
  7.    function PlayerStatus()
  8.    {
  9.       this.doGenerateNewLevels();
  10.    }
  11.    function getLevelData(__nLevelType, __nLevelNum)
  12.    {
  13.       var _loc4_ = undefined;
  14.       if(__nLevelType == BaseLevelData.LEVEL_TYPE_STORY)
  15.       {
  16.          var _loc2_ = 0;
  17.          while(_loc2_ <= this.aStoryLevels.length - 1)
  18.          {
  19.             var _loc3_ = this.aStoryLevels[_loc2_];
  20.             if(_loc3_.LevelNumber == __nLevelNum)
  21.             {
  22.                _loc4_ = _loc3_;
  23.                _loc2_ = this.aStoryLevels.length;
  24.             }
  25.             _loc2_ = _loc2_ + 1;
  26.          }
  27.       }
  28.       else if(__nLevelType == BaseLevelData.LEVEL_TYPE_USER)
  29.       {
  30.          _loc2_ = 0;
  31.          while(_loc2_ <= this.aUserLevels.length - 1)
  32.          {
  33.             _loc3_ = this.aUserLevels[_loc2_];
  34.             if(_loc3_.LevelNumber == __nLevelNum)
  35.             {
  36.                _loc4_ = _loc3_;
  37.                _loc2_ = this.aUserLevels.length;
  38.             }
  39.             _loc2_ = _loc2_ + 1;
  40.          }
  41.       }
  42.       return _loc4_;
  43.    }
  44.    function getLevelQuantity(__nLevelType)
  45.    {
  46.       var _loc2_ = 0;
  47.       if(__nLevelType == BaseLevelData.LEVEL_TYPE_STORY)
  48.       {
  49.          _loc2_ = this.aStoryLevels.length;
  50.       }
  51.       else if(__nLevelType == BaseLevelData.LEVEL_TYPE_USER)
  52.       {
  53.          _loc2_ = this.aUserLevels.length;
  54.       }
  55.       return _loc2_;
  56.    }
  57.    function doDeleteUserLevel(__oLevel)
  58.    {
  59.       for(var _loc3_ in this.aUserLevels)
  60.       {
  61.          var _loc2_ = this.aUserLevels[_loc3_];
  62.          if(_loc2_ == __oLevel)
  63.          {
  64.             _loc2_.doDeleteFromSave();
  65.             this.aUserLevels.splice(Number(_loc3_),1);
  66.          }
  67.       }
  68.    }
  69.    function doAddUserLevel(__oLevel)
  70.    {
  71.       this.aUserLevels.push(__oLevel);
  72.    }
  73.    function doDestroy()
  74.    {
  75.       this.aStoryLevels = new Array();
  76.       this.aUserLevels = new Array();
  77.       delete this.aStoryLevels;
  78.       delete this.aUserLevels;
  79.    }
  80.    function doGenerateNewLevels()
  81.    {
  82.       this.aStoryLevels = new Array();
  83.       this.aStoryLevels.push(new StoryLevels.StoryLevel_01());
  84.       this.aStoryLevels.push(new StoryLevels.StoryLevel_02());
  85.       this.aStoryLevels.push(new StoryLevels.StoryLevel_03());
  86.       this.aStoryLevels.push(new StoryLevels.StoryLevel_04());
  87.       for(var _loc2_ in this.aStoryLevels)
  88.       {
  89.          this.aStoryLevels[_loc2_].onInit();
  90.       }
  91.       this.doFetchUserLevels();
  92.    }
  93.    function doFetchUserLevels()
  94.    {
  95.       this.aUserLevels = new Array();
  96.       var _loc6_ = SharedObject.getLocal(PlayerStatus.SAVE_SO_NAME);
  97.       var _loc5_ = 1;
  98.       while(_loc5_ <= PlayerStatus.MAX_USER_LEVELS)
  99.       {
  100.          var _loc3_ = _loc6_.data["LevelType" + BaseLevelData.LEVEL_TYPE_USER + "_LevelNumber" + _loc5_];
  101.          if(_loc3_ != undefined)
  102.          {
  103.             var _loc2_ = new BaseLevelData();
  104.             _loc2_.LevelNumber = _loc3_.nLevelNumber;
  105.             _loc2_.LevelName = _loc3_.sLevelName;
  106.             _loc2_.LevelType = BaseLevelData.LEVEL_TYPE_USER;
  107.             _loc2_.RequiredMS = _loc3_.nRequiredMS;
  108.             _loc2_.TimeAllowed = _loc3_.nTimeAllowed;
  109.             _loc2_.sPanelBg1 = "Amb_LE_mcBgPanel1";
  110.             _loc2_.aPanelBg2.push("Amb_LE_mcBgPanel2_A");
  111.             _loc2_.aPanelBg2.push("Amb_LE_mcBgPanel2_B");
  112.             _loc2_.aPanelBg2.push("Amb_LE_mcBgPanel2_C");
  113.             _loc2_.nFloorHeight = 345;
  114.             _loc2_.sPanelStart = "Amb_LE_mcGamePanel_Start";
  115.             _loc2_.sPanelEnd = "Amb_LE_mcGamePanel_End";
  116.             var _loc4_ = 0;
  117.             while(_loc4_ <= _loc3_.aPanels.length - 1)
  118.             {
  119.                _loc2_.Panels.push(_loc3_.aPanels[_loc4_]);
  120.                _loc4_ = _loc4_ + 1;
  121.             }
  122.             this.doAddUserLevel(_loc2_);
  123.             _loc2_.onInit();
  124.          }
  125.          _loc5_ = _loc5_ + 1;
  126.       }
  127.       false;
  128.    }
  129. }
  130.